﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Eniux.Framework.Infrastructure.core;

namespace HotKeyTest
{
    /// <summary>
    /// MainWindow.xaml 的交互逻辑
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Loaded += new RoutedEventHandler(MainWindow_Loaded);
        }

        void MainWindow_KeyDown(object sender, KeyEventArgs e)
        {
            MessageBox.Show(Keyboard.Modifiers.ToString()+"+"+e.Key);
        }
        void MainWindow_KeyDown2(object sender, System.Windows.Forms.KeyEventArgs e)
        {
            MessageBox.Show(e.Modifiers.ToString() + "+" + (System.Windows.Forms.Keys)e.KeyCode);
        }

        void MainWindow_KeyDown3(object sender, KeyEventArgs e)
        {
            MessageBox.Show(Keyboard.Modifiers.ToString() + "+" + e.Key);
        }
        void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            HotKeyManager.RegisterHotKey(this, ModifierKeys.Control, System.Windows.Forms.Keys.F12,new KeyEventHandler(this.MainWindow_KeyDown));
            HotKeyManager.RegisterHotKey(this, ModifierKeys.Alt, System.Windows.Forms.Keys.F10, new System.Windows.Forms.KeyEventHandler(this.MainWindow_KeyDown2));
            HotKeyManager.RegisterHotKey(this, ModifierKeys.Shift, System.Windows.Forms.Keys.P, new KeyEventHandler(this.MainWindow_KeyDown3));
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            new Window1().Show();
        }


    }
}
